
package com.thyc.utils;

import java.io.*;

public class IOClass {
    public static void main(String[] args) throws IOException {
        String fileName = "20220213";
        String s;


        File file = new File("e:\\sourcedata-20220213.cvs");
        BufferedReader br = new BufferedReader(new FileReader(file));


        File file0 = new File("e:\\sourcedata\\"+ fileName +"(1-X).cvs");
        BufferedWriter onex = new BufferedWriter(new FileWriter(file0,true));

        File file1 = new File("e:\\sourcedata\\"+ fileName +"(1-Y).cvs");
        BufferedWriter oney = new BufferedWriter(new FileWriter(file1,true));

        File file2 = new File("e:\\sourcedata\\"+ fileName +"(1-Z).cvs");
        BufferedWriter onez = new BufferedWriter(new FileWriter(file2,true));

        File file3 = new File("e:\\sourcedata\\"+ fileName +"(2-Y).cvs");
        BufferedWriter twoy = new BufferedWriter(new FileWriter(file3,true));

        File file4 = new File("e:\\sourcedata\\"+ fileName +"(2-Z).cvs");
        BufferedWriter twoz = new BufferedWriter(new FileWriter(file4,true));

        File file5 = new File("e:\\sourcedata\\"+ fileName +"(3-X).cvs");
        BufferedWriter threex = new BufferedWriter(new FileWriter(file5,true));

        File file6 = new File("e:\\sourcedata\\"+ fileName +"(3-Y).cvs");
        BufferedWriter threey = new BufferedWriter(new FileWriter(file6,true));

        File file7 = new File("e:\\sourcedata\\"+ fileName +"(3-Z).cvs");
        BufferedWriter threez = new BufferedWriter(new FileWriter(file7,true));

        File file8 = new File("e:\\sourcedata\\"+ fileName +"(4-Y).cvs");
        BufferedWriter foury = new BufferedWriter(new FileWriter(file8,true));

        File file9 = new File("e:\\sourcedata\\"+ fileName +"(4-Z).cvs");
        BufferedWriter fourz = new BufferedWriter(new FileWriter(file9,true));

        File file10 = new File("e:\\sourcedata\\"+ fileName +"(5-X).cvs");
        BufferedWriter fivex = new BufferedWriter(new FileWriter(file10,true));

        File file11 = new File("e:\\sourcedata\\"+ fileName +"(5-Y).cvs");
        BufferedWriter fivey = new BufferedWriter(new FileWriter(file11,true));

        File file12 = new File("e:\\sourcedata\\"+ fileName +"(5-Z).cvs");
        BufferedWriter fivez = new BufferedWriter(new FileWriter(file12,true));

        File file13 = new File("e:\\sourcedata\\"+ fileName +"(6-X).cvs");
        BufferedWriter sixx = new BufferedWriter(new FileWriter(file13,true));

        File file14 = new File("e:\\sourcedata\\"+ fileName +"(6-Y).cvs");
        BufferedWriter sixy = new BufferedWriter(new FileWriter(file14,true));

        File file15 = new File("e:\\sourcedata\\"+ fileName +"(6-Z).cvs");
        BufferedWriter sixz = new BufferedWriter(new FileWriter(file15,true));
        while ((s = br.readLine()) != null) {

            if (s.contains("1-X")) {
                onex.write(s);
                onex.write("\r\n");
                onex.flush();
            }

            if (s.contains("1-Y")) {
                oney.write(s);
                oney.write("\r\n");
                oney.flush();
            }

            if (s.contains("1-Z")) {
                onez.write(s);
                onez.write("\r\n");
                onez.flush();
            }

            if (s.contains("2-Y")) {
                twoy.write(s);
                twoy.write("\r\n");
                twoy.flush();
            }

            if (s.contains("2-Z")) {
                twoz.write(s);
                twoz.write("\r\n");
                twoz.flush();
            }

            if (s.contains("3-X")) {
                threex.write(s);
                threex.write("\r\n");
                threex.flush();
            }

            if (s.contains("3-Y")) {
                threey.write(s);
                threey.write("\r\n");
                threey.flush();
            }

            if (s.contains("3-Z")) {
                threez.write(s);
                threez.write("\r\n");
                threez.flush();
            }

            if (s.contains("4-Y")) {
                foury.write(s);
                foury.write("\r\n");
                foury.flush();
            }

            if (s.contains("4-Z")) {
                fourz.write(s);
                fourz.write("\r\n");
                fourz.flush();
            }

            if (s.contains("5-X")) {
                fivex.write(s);
                fivex.write("\r\n");
                fivex.flush();
            }

            if (s.contains("5-Y")) {
                fivey.write(s);
                fivey.write("\r\n");
                fivey.flush();
            }

            if (s.contains("5-Z")) {
                fivez.write(s);
                fivez.write("\r\n");
                fivez.flush();
            }

            if (s.contains("6-X")) {
                sixx.write(s);
                sixx.write("\r\n");
                sixx.flush();
            }

            if (s.contains("6-Y")) {
                sixy.write(s);
                sixy.write("\r\n");
                sixy.flush();
            }

            if (s.contains("6-Z")) {
                sixz.write(s);
                sixz.write("\r\n");
                sixz.flush();
            }
        }
        onex.close();
        oney.close();
        onez.close();
        twoy.close();
        twoz.close();
        threex.close();
        threey.close();
        threez.close();
        foury.close();
        fourz.close();
        fivex.close();
        fivey.close();
        fivez.close();
        sixx.close();
        sixy.close();
        sixz.close();
        br.close();
    }
}